var myDao = require("../lib/myDao.js");

var userDao = new myDao("http://localhost:8080/myDB/test/", "user");



function create() {
	userDao.createTable({
		name: {
			dbType: "varchar"
		},
		age: {
			dbType: "integer"
		},
		intro: {
			dbType: "text"
		}
	}, function(ok, data) {

		console.log(ok, data);
	})
}


function add() {
	userDao.add({
		row: {
			name: "wang",
			age: 22,
			intro: "wangIntro"
		}
	}, function(ok, data) {
		console.log(ok, data);
	})
}

function adds() {
	userDao.adds({
		rows: [{
			name: "li",
			age: 33,
			intro: "liIntro"
		}, {
			name: "qian",
			age: 44,
			intro: "qianIntro"
		}]
	}, function(ok, data) {
		console.log(ok, data);
	})
}


function adds_csv () {
	userDao.addsByCsv({keys:["name","age","intro"],valuess:[["zang",66,"zang_intro"],["zhao",77,"zhao_intor"]]},function  (ok,data) {
		console.log(ok,data);
	})
}


function get() {
	userDao.getByWhere({}, function(ok, data) {
		console.log(ok, data)
	})
}

function del () {
	userDao.delByWhere(undefined,function  (ok,data) {
		console.log(ok, data)
	})
}


function edit () {
	userDao.editByWhere({row:{age:11,name:"aaa"}},function  (ok,data) {
		console.log(ok, data)
	})
}

function main(argument) {

	//create();
	// add();
	// adds();
	// adds_csv();


	// del();
	// edit();

	
	get();

}
main();